<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
function done(){
	var obj = window.dialogArguments;
    obj.returnvalue = "${filepath}";
	window.close();
}
</script>
</head>
<body>
	<form method="POST" action="upload" enctype="multipart/form-data">
		<br/>Image to upload: <input type="file" name="file"><br /> <input
			type="submit" value="Upload"> Press here to upload the file!
			<br/>
			<c:if test="${message!=null}">
			<c:out value="${message}"></c:out>
			<c:if test="${filepath!=null}">
			<img alt="" src="<%=request.getContextPath()%>${filepath}">
			<button onclick="done()">Done</button>
			</c:if>
		</c:if>
	</form>
</body>
</html>